## pval_cutoff: 0.05
## lfc_cutoff: 1
## low_counts_cutoff: 10

General statistics

# Number of samples
length(counts_data)
## [1] 6
# Number of genes
nrow(counts_data)
## [1] 49315
# Total counts
colSums(counts_data)
## SRR13535276 SRR13535278 SRR13535280 SRR13535300 SRR13535302 SRR13535304 
##     5442647     5284506     6692745     6783939     5245017     3380080

Create DDS objects

# Create DESeqDataSet object
dds <- get_DESeqDataSet_obj(counts_data, ~ treatment)
## [1] TRUE
## [1] TRUE
## [1] "DESeqDataSet object of length 49315 with 0 metadata columns"
## [1] "DESeqDataSet object of length 13961 with 0 metadata columns"
colData(dds)
## DataFrame with 6 rows and 25 columns
##              Assay Type AvgSpotLen       Bases  BioProject    BioSample      Bytes Center Name     Consent DATASTORE filetype DATASTORE provider       DATASTORE region  Experiment treatment GEO_Accession (exp)          Instrument LibraryLayout LibrarySelection  LibrarySource     Organism    Platform                    label ReleaseDate Sample Name            source_name   SRA Study
##             <character>  <numeric>   <numeric> <character>  <character>  <numeric> <character> <character>        <character>        <character>            <character> <character>  <factor>         <character>         <character>   <character>      <character>    <character>  <character> <character>                 <factor>   <POSIXct> <character>            <character> <character>
## SRR13535276     RNA-Seq        300  8225466000 PRJNA694971 SAMN17588686 3252113587         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943360         A          GSM5043430 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA in space without gravity  2021-09-09  GSM5043430 C2C12 proliferating ..   SRP303354
## SRR13535278     RNA-Seq        300  9203426700 PRJNA694971 SAMN17588684 3619152333         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943362         A          GSM5043433 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA in space without gravity  2021-09-09  GSM5043433 C2C12 proliferating ..   SRP303354
## SRR13535280     RNA-Seq        300  9323939700 PRJNA694971 SAMN17588682 3735905901         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943364         A          GSM5043436 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA in space without gravity  2021-09-09  GSM5043436 C2C12 proliferating ..   SRP303354
## SRR13535300     RNA-Seq        300 12820015200 PRJNA694971 SAMN17587361 5047533646         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943384         E          GSM5043471 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA on land                   2021-09-09  GSM5043471 C2C12 proliferating ..   SRP303354
## SRR13535302     RNA-Seq        300 12499917600 PRJNA694971 SAMN17587359 4941074444         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943386         E          GSM5043475 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA on land                   2021-09-09  GSM5043475 C2C12 proliferating ..   SRP303354
## SRR13535304     RNA-Seq        300  7150086300 PRJNA694971 SAMN17587357 2845819297         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943388         E          GSM5043478 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA on land                   2021-09-09  GSM5043478 C2C12 proliferating ..   SRP303354

Sample-to-sample comparisons

# Transform data (blinded rlog)
rld <- get_transformed_data(dds)

PCA plot

pca <- rld$pca
pca_df <- cbind(as.data.frame(colData(dds)) %>% rownames_to_column(var = 'name'), pca$x)
summary(pca)
## Importance of components:
##                            PC1     PC2     PC3      PC4      PC5       PC6
## Standard deviation     42.7426 37.4963 27.3551 20.29918 19.16927 6.947e-14
## Proportion of Variance  0.3837  0.2953  0.1572  0.08655  0.07719 0.000e+00
## Cumulative Proportion   0.3837  0.6791  0.8363  0.92281  1.00000 1.000e+00
ggplot(pca_df, aes(x = PC1, y = PC2, color = label)) +
  geom_point() +
  geom_text(aes(label = name), position = position_nudge(y = -2), show.legend = F, size = 3) +
  scale_color_manual(values = colors_default) +
  scale_x_continuous(expand = c(0.2, 0))

Correlation heatmap

pheatmap(
  cor(rld$matrix),
  annotation_col = as.data.frame(colData(dds)) %>% select(label),
  color = brewer.pal(8, 'YlOrRd')
)

Wald test results

# DE analysis using Wald test
dds_full <- DESeq(dds)
colData(dds_full)
## DataFrame with 6 rows and 26 columns
##              Assay Type AvgSpotLen       Bases  BioProject    BioSample      Bytes Center Name     Consent DATASTORE filetype DATASTORE provider       DATASTORE region  Experiment treatment GEO_Accession (exp)          Instrument LibraryLayout LibrarySelection  LibrarySource     Organism    Platform                    label ReleaseDate Sample Name            source_name   SRA Study sizeFactor
##             <character>  <numeric>   <numeric> <character>  <character>  <numeric> <character> <character>        <character>        <character>            <character> <character>  <factor>         <character>         <character>   <character>      <character>    <character>  <character> <character>                 <factor>   <POSIXct> <character>            <character> <character>  <numeric>
## SRR13535276     RNA-Seq        300  8225466000 PRJNA694971 SAMN17588686 3252113587         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943360         A          GSM5043430 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA in space without gravity  2021-09-09  GSM5043430 C2C12 proliferating ..   SRP303354   0.983327
## SRR13535278     RNA-Seq        300  9203426700 PRJNA694971 SAMN17588684 3619152333         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943362         A          GSM5043433 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA in space without gravity  2021-09-09  GSM5043433 C2C12 proliferating ..   SRP303354   1.201268
## SRR13535280     RNA-Seq        300  9323939700 PRJNA694971 SAMN17588682 3735905901         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943364         A          GSM5043436 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA in space without gravity  2021-09-09  GSM5043436 C2C12 proliferating ..   SRP303354   1.114408
## SRR13535300     RNA-Seq        300 12820015200 PRJNA694971 SAMN17587361 5047533646         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943384         E          GSM5043471 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA on land                   2021-09-09  GSM5043471 C2C12 proliferating ..   SRP303354   1.515920
## SRR13535302     RNA-Seq        300 12499917600 PRJNA694971 SAMN17587359 4941074444         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943386         E          GSM5043475 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA on land                   2021-09-09  GSM5043475 C2C12 proliferating ..   SRP303354   0.802284
## SRR13535304     RNA-Seq        300  7150086300 PRJNA694971 SAMN17587357 2845819297         GEO      public          fastq,sra         gs,ncbi,s3 gs.US,ncbi.public,s3..  SRX9943388         E          GSM5043478 Illumina HiSeq 2500        PAIRED             cDNA TRANSCRIPTOMIC Mus musculus    ILLUMINA on land                   2021-09-09  GSM5043478 C2C12 proliferating ..   SRP303354   0.599689
# Wald test results
res <- results(
  dds_full,
  contrast = c('treatment', condition, control),
  alpha = pval_cutoff
)
res
## log2 fold change (MLE): treatment A vs E 
## Wald test p-value: treatment A vs E 
## DataFrame with 13961 rows and 6 columns
##                     baseMean log2FoldChange     lfcSE      stat    pvalue      padj
##                    <numeric>      <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSMUSG00000025900   2.61498      -4.962524  2.553251 -1.943610 0.0519425        NA
## ENSMUSG00000098104   6.17973      -0.339872  0.953765 -0.356348 0.7215799        NA
## ENSMUSG00000033845  78.73893      -0.139777  0.484080 -0.288747 0.7727748  0.919754
## ENSMUSG00000102275   1.93535      -0.248188  1.752974 -0.141581 0.8874108        NA
## ENSMUSG00000025903  64.57553      -0.218443  0.653769 -0.334129 0.7382824  0.907746
## ...                      ...            ...       ...       ...       ...       ...
## ENSMUSG00000061654   1.27223       0.825925  3.184504  0.259357 0.7953595        NA
## ENSMUSG00000079834  14.09960       1.903612  1.045337  1.821050 0.0685992  0.344032
## ENSMUSG00000095041 158.20403       0.140872  0.612231  0.230095 0.8180177  0.938169
## ENSMUSG00000063897  20.52396      -0.458058  0.853403 -0.536743 0.5914454  0.836773
## ENSMUSG00000095742   7.49461      -0.218513  1.062907 -0.205580 0.8371187        NA
mcols(res)
## DataFrame with 6 rows and 2 columns
##                        type            description
##                 <character>            <character>
## baseMean       intermediate mean of normalized c..
## log2FoldChange      results log2 fold change (ML..
## lfcSE               results standard error: trea..
## stat                results Wald statistic: trea..
## pvalue              results Wald test p-value: t..
## padj                results   BH adjusted p-values
summary(res)
## 
## out of 13961 with nonzero total read count
## adjusted p-value < 0.05
## LFC > 0 (up)       : 239, 1.7%
## LFC < 0 (down)     : 104, 0.74%
## outliers [1]       : 169, 1.2%
## low counts [2]     : 3519, 25%
## (mean count < 8)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
plotDispEsts(dds_full)

Summary details

# Upregulated genes (LFC > 0)
res_sig_df %>% filter(log2FoldChange > 0)
# Downregulated genes (LFC < 0)
res_sig_df %>% filter(log2FoldChange < 0)
# Outliers (pvalue and padj are NA)
res[which(is.na(res$pvalue)), ]
## log2 fold change (MLE): treatment A vs E 
## Wald test p-value: treatment A vs E 
## DataFrame with 169 rows and 6 columns
##                     baseMean log2FoldChange     lfcSE      stat    pvalue      padj
##                    <numeric>      <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSMUSG00000067780  221.9873      -2.582501   1.46924 -1.757707        NA        NA
## ENSMUSG00000025981  118.3309      -0.529115   1.15229 -0.459187        NA        NA
## ENSMUSG00000038349   75.0131      -4.200908   1.26705 -3.315497        NA        NA
## ENSMUSG00000026024   42.2767      -3.720642   1.35025 -2.755516        NA        NA
## ENSMUSG00000085842   18.6638       6.046114   3.47619  1.739291        NA        NA
## ...                      ...            ...       ...       ...       ...       ...
## ENSMUSG00000005871   313.558      -0.607219   1.04277 -0.582315        NA        NA
## ENSMUSG00000044595    35.330       1.595573   1.67162  0.954505        NA        NA
## ENSMUSG00000024597   269.224      -1.425211   1.09095 -1.306397        NA        NA
## ENSMUSG00000033417   193.435      -1.252626   1.07430 -1.165996        NA        NA
## ENSMUSG00000064340   120.809       0.332759   1.16820  0.284847        NA        NA
# Low counts (only padj is NA)
res[which(is.na(res$padj) & !is.na(res$pvalue)), ]
## log2 fold change (MLE): treatment A vs E 
## Wald test p-value: treatment A vs E 
## DataFrame with 3519 rows and 6 columns
##                     baseMean log2FoldChange     lfcSE      stat    pvalue      padj
##                    <numeric>      <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSMUSG00000025900   2.61498      -4.962524  2.553251 -1.943610 0.0519425        NA
## ENSMUSG00000098104   6.17973      -0.339872  0.953765 -0.356348 0.7215799        NA
## ENSMUSG00000102275   1.93535      -0.248188  1.752974 -0.141581 0.8874108        NA
## ENSMUSG00000090031   4.72015       2.124519  1.341590  1.583583 0.1132885        NA
## ENSMUSG00000098201   1.51075       1.802079  1.856699  0.970583 0.3317561        NA
## ...                      ...            ...       ...       ...       ...       ...
## ENSMUSG00000065947   5.24532       0.261970   1.04998  0.249499  0.802975        NA
## ENSMUSG00000064366   2.13604      -0.772911   2.41976 -0.319417  0.749410        NA
## ENSMUSG00000064372   6.86230      -0.401501   1.08759 -0.369167  0.712003        NA
## ENSMUSG00000061654   1.27223       0.825925   3.18450  0.259357  0.795359        NA
## ENSMUSG00000095742   7.49461      -0.218513   1.06291 -0.205580  0.837119        NA

Shrunken LFC results

plotMA(res)

# Shrunken LFC results
res_shrunken <- lfcShrink(
  dds_full,
  coef = str_c('treatment_', condition, '_vs_', control),
  type = 'apeglm'
)
res_shrunken
## log2 fold change (MAP): treatment A vs E 
## Wald test p-value: treatment A vs E 
## DataFrame with 13961 rows and 5 columns
##                     baseMean log2FoldChange     lfcSE    pvalue      padj
##                    <numeric>      <numeric> <numeric> <numeric> <numeric>
## ENSMUSG00000025900   2.61498     -0.1300702  0.514057 0.0519425        NA
## ENSMUSG00000098104   6.17973     -0.0711113  0.441210 0.7215799        NA
## ENSMUSG00000033845  78.73893     -0.0702829  0.346909 0.7727748  0.919754
## ENSMUSG00000102275   1.93535     -0.0175174  0.472511 0.8874108        NA
## ENSMUSG00000025903  64.57553     -0.0783319  0.396773 0.7382824  0.907746
## ...                      ...            ...       ...       ...       ...
## ENSMUSG00000061654   1.27223      0.0194986  0.484854 0.7953595        NA
## ENSMUSG00000079834  14.09960      0.4149437  0.670691 0.0685992  0.344032
## ENSMUSG00000095041 158.20403      0.0563089  0.384739 0.8180177  0.938169
## ENSMUSG00000063897  20.52396     -0.1154234  0.438228 0.5914454  0.836773
## ENSMUSG00000095742   7.49461     -0.0384303  0.445851 0.8371187        NA
plotMA(res_shrunken)

mcols(res_shrunken)
## DataFrame with 5 rows and 2 columns
##                        type            description
##                 <character>            <character>
## baseMean       intermediate mean of normalized c..
## log2FoldChange      results log2 fold change (MA..
## lfcSE               results posterior SD: treatm..
## pvalue              results Wald test p-value: t..
## padj                results   BH adjusted p-values
summary(res_shrunken, alpha = pval_cutoff)
## 
## out of 13961 with nonzero total read count
## adjusted p-value < 0.05
## LFC > 0 (up)       : 239, 1.7%
## LFC < 0 (down)     : 104, 0.74%
## outliers [1]       : 169, 1.2%
## low counts [2]     : 3519, 25%
## (mean count < 8)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results

Summary details

# Upregulated genes (LFC > 0)
res_shrunken_sig_df %>% filter(log2FoldChange > 0)
# Downregulated genes (LFC < 0)
res_shrunken_sig_df %>% filter(log2FoldChange < 0)
# Outliers (pvalue and padj are NA)
res_shrunken[which(is.na(res_shrunken$pvalue)), ]
## log2 fold change (MAP): treatment A vs E 
## Wald test p-value: treatment A vs E 
## DataFrame with 169 rows and 5 columns
##                     baseMean log2FoldChange     lfcSE    pvalue      padj
##                    <numeric>      <numeric> <numeric> <numeric> <numeric>
## ENSMUSG00000067780  221.9873     -0.2417310  0.561932        NA        NA
## ENSMUSG00000025981  118.3309     -0.0799970  0.459272        NA        NA
## ENSMUSG00000038349   75.0131     -3.2042335  1.586687        NA        NA
## ENSMUSG00000026024   42.2767     -0.4662874  0.878920        NA        NA
## ENSMUSG00000085842   18.6638      0.0641954  0.495755        NA        NA
## ...                      ...            ...       ...       ...       ...
## ENSMUSG00000005871   313.558     -0.1092319  0.458138        NA        NA
## ENSMUSG00000044595    35.330      0.1222203  0.494985        NA        NA
## ENSMUSG00000024597   269.224     -0.2527030  0.531987        NA        NA
## ENSMUSG00000033417   193.435     -0.2253146  0.511858        NA        NA
## ENSMUSG00000064340   120.809      0.0514497  0.455209        NA        NA
# Low counts (only padj is NA)
res_shrunken[which(is.na(res_shrunken$padj) & !is.na(res_shrunken$pvalue)), ]
## log2 fold change (MAP): treatment A vs E 
## Wald test p-value: treatment A vs E 
## DataFrame with 3519 rows and 5 columns
##                     baseMean log2FoldChange     lfcSE    pvalue      padj
##                    <numeric>      <numeric> <numeric> <numeric> <numeric>
## ENSMUSG00000025900   2.61498     -0.1300702  0.514057 0.0519425        NA
## ENSMUSG00000098104   6.17973     -0.0711113  0.441210 0.7215799        NA
## ENSMUSG00000102275   1.93535     -0.0175174  0.472511 0.8874108        NA
## ENSMUSG00000090031   4.72015      0.2857734  0.575077 0.1132885        NA
## ENSMUSG00000098201   1.51075      0.1227917  0.495432 0.3317561        NA
## ...                      ...            ...       ...       ...       ...
## ENSMUSG00000065947   5.24532      0.0481426  0.445980  0.802975        NA
## ENSMUSG00000064366   2.13604     -0.0302867  0.481739  0.749410        NA
## ENSMUSG00000064372   6.86230     -0.0666771  0.452667  0.712003        NA
## ENSMUSG00000061654   1.27223      0.0194986  0.484854  0.795359        NA
## ENSMUSG00000095742   7.49461     -0.0384303  0.445851  0.837119        NA

Visualizing results

Heatmaps

# Plot normalized counts (z-scores)
pheatmap(counts_sig_norm[2:7], 
         color = brewer.pal(8, 'YlOrRd'), 
         cluster_rows = T, 
         show_rownames = F,
         annotation_col = as.data.frame(colData(dds)) %>% select(label),
         border_color = NA,
         fontsize = 10,
         scale = 'row',
         fontsize_row = 10, 
         height = 20)

# Plot log-transformed counts
pheatmap(counts_sig_log[2:7], 
         color = rev(brewer.pal(8, 'RdYlBu')), 
         cluster_rows = T, 
         show_rownames = F,
         annotation_col = as.data.frame(colData(dds)) %>% select(label),
         border_color = NA,
         fontsize = 10,
         fontsize_row = 10, 
         height = 20)

# Plot log-transformed counts (top 24 DE genes)
pheatmap(counts_sig_log %>% filter(ensembl_gene_id %in% (res_sig_df %>% head(24))$ensembl_gene_id) %>% select(-ensembl_gene_id) %>% column_to_rownames(var = 'mgi_symbol'),
         color = rev(brewer.pal(8, 'RdYlBu')), 
         cluster_rows = T, 
         show_rownames = T,
         annotation_col = as.data.frame(colData(dds)) %>% select(label), 
         fontsize = 10,
         fontsize_row = 10, 
         height = 20)

Volcano plots

# Unshrunken LFC
res_df %>% 
  mutate(
    sig_threshold = if_else(
      padj < pval_cutoff & abs(log2FoldChange) >= lfc_cutoff,
      if_else(log2FoldChange > 0, 'DE-up', 'DE-down'),
      'non-DE'
    )
  ) %>% 
  filter(!is.na(sig_threshold)) %>% 
  ggplot() +
  geom_point(aes(x = log2FoldChange, y = -log10(padj), colour = sig_threshold)) +
  scale_color_manual(values = c('blue', 'red', 'gray')) +
  xlab('log2 fold change') + 
  ylab('-log10 adjusted p-value')

# Shrunken LFC
res_shrunken_df %>% 
  mutate(
    sig_threshold = if_else(
      padj < pval_cutoff & abs(log2FoldChange) >= lfc_cutoff,
      if_else(log2FoldChange > 0, 'DE-up', 'DE-down'),
      'non-DE'
    )
  ) %>% 
  filter(!is.na(sig_threshold)) %>% 
  ggplot() +
  geom_point(aes(x = log2FoldChange, y = -log10(padj), colour = sig_threshold)) +
  scale_color_manual(values = c('blue', 'red', 'gray')) +
  xlab('log2 fold change') + 
  ylab('-log10 adjusted p-value')

GSEA (all)

Hallmark genesets

# Shrunken LFC
get_fgsea_res(rank_lfc, mm_h) %>% plot_enrichment_table(rank_lfc, mm_h)

# Wald stat
get_fgsea_res(rank_stat, mm_h) %>% plot_enrichment_table(rank_stat, mm_h)

# Rank: sign(LFC) * -log10(pvalue)
get_fgsea_res(rank_pval, mm_h) %>% plot_enrichment_table(rank_pval, mm_h)

GO biological process

# Shrunken LFC
get_fgsea_res(rank_lfc, mm_c5_bp) %>% plot_enrichment_table(rank_lfc, mm_c5_bp)

# Wald stat
get_fgsea_res(rank_stat, mm_c5_bp) %>% plot_enrichment_table(rank_stat, mm_c5_bp)

# Rank: sign(LFC) * -log10(pvalue)
get_fgsea_res(rank_pval, mm_c5_bp) %>% plot_enrichment_table(rank_pval, mm_c5_bp)

GO cellular component

# Shrunken LFC
get_fgsea_res(rank_lfc, mm_c5_cc) %>% plot_enrichment_table(rank_lfc, mm_c5_cc)

# Wald stat
get_fgsea_res(rank_stat, mm_c5_cc) %>% plot_enrichment_table(rank_stat, mm_c5_cc)

# Rank: sign(LFC) * -log10(pvalue)
get_fgsea_res(rank_pval, mm_c5_cc) %>% plot_enrichment_table(rank_pval, mm_c5_cc)

GO molecular function

# Shrunken LFC
get_fgsea_res(rank_lfc, mm_c5_mf) %>% plot_enrichment_table(rank_lfc, mm_c5_mf)

# Wald stat
get_fgsea_res(rank_stat, mm_c5_mf) %>% plot_enrichment_table(rank_stat, mm_c5_mf)

# Rank: sign(LFC) * -log10(pvalue)
get_fgsea_res(rank_pval, mm_c5_mf) %>% plot_enrichment_table(rank_pval, mm_c5_mf)

GSEA (DE)

Hallmark genesets

# Shrunken LFC
get_fgsea_res(rank_lfc, mm_h) %>% plot_enrichment_table(rank_lfc, mm_h)

# Wald stat
get_fgsea_res(rank_stat, mm_h) %>% plot_enrichment_table(rank_stat, mm_h)

# Rank: sign(LFC) * -log10(pvalue)
get_fgsea_res(rank_pval, mm_h) %>% plot_enrichment_table(rank_pval, mm_h)

GO biological process

# Shrunken LFC
get_fgsea_res(rank_lfc, mm_c5_bp) %>% plot_enrichment_table(rank_lfc, mm_c5_bp)

# Wald stat
get_fgsea_res(rank_stat, mm_c5_bp) %>% plot_enrichment_table(rank_stat, mm_c5_bp)

# Rank: sign(LFC) * -log10(pvalue)
get_fgsea_res(rank_pval, mm_c5_bp) %>% plot_enrichment_table(rank_pval, mm_c5_bp)

GO cellular component

# Shrunken LFC
get_fgsea_res(rank_lfc, mm_c5_cc) %>% plot_enrichment_table(rank_lfc, mm_c5_cc)

# Wald stat
get_fgsea_res(rank_stat, mm_c5_cc) %>% plot_enrichment_table(rank_stat, mm_c5_cc)

# Rank: sign(LFC) * -log10(pvalue)
get_fgsea_res(rank_pval, mm_c5_cc) %>% plot_enrichment_table(rank_pval, mm_c5_cc)

GO molecular function

# Shrunken LFC
get_fgsea_res(rank_lfc, mm_c5_mf) %>% plot_enrichment_table(rank_lfc, mm_c5_mf)

# Wald stat
get_fgsea_res(rank_stat, mm_c5_mf) %>% plot_enrichment_table(rank_stat, mm_c5_mf)

# Rank: sign(LFC) * -log10(pvalue)
get_fgsea_res(rank_pval, mm_c5_mf) %>% plot_enrichment_table(rank_pval, mm_c5_mf)

System info

sessionInfo()
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-conda-linux-gnu (64-bit)
## Running under: CentOS Linux 7 (Core)
## 
## Matrix products: default
## BLAS/LAPACK: /home/chan/mRNA_seq_pipeline/.snakemake/conda/9a19315a020c824d12f8055f7c009b0f/lib/libopenblasp-r0.3.18.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] fgsea_1.20.0                RColorBrewer_1.1-2          pheatmap_1.0.12             DESeq2_1.34.0               SummarizedExperiment_1.24.0 Biobase_2.54.0              MatrixGenerics_1.6.0        matrixStats_0.61.0          GenomicRanges_1.46.0        GenomeInfoDb_1.30.0         IRanges_2.28.0              S4Vectors_0.32.0            BiocGenerics_0.40.0         scales_1.1.1                forcats_0.5.1               stringr_1.4.0               dplyr_1.0.7                 purrr_0.3.4                 readr_2.1.1                 tidyr_1.1.4                 tibble_3.1.6                ggplot2_3.3.5               tidyverse_1.3.1            
## 
## loaded via a namespace (and not attached):
##  [1] colorspace_2.0-2       ellipsis_0.3.2         XVector_0.34.0         fs_1.5.1               rstudioapi_0.13        farver_2.1.0           bit64_4.0.5            mvtnorm_1.1-3          AnnotationDbi_1.56.1   fansi_0.4.2            apeglm_1.16.0          lubridate_1.8.0        xml2_1.3.3             splines_4.1.0          cachem_1.0.6           geneplotter_1.72.0     knitr_1.35             jsonlite_1.7.2         broom_0.7.10           annotate_1.72.0        dbplyr_2.1.1           png_0.1-7              compiler_4.1.0         httr_1.4.2             backports_1.4.0        assertthat_0.2.1       Matrix_1.3-4           fastmap_1.1.0          cli_3.1.0              htmltools_0.5.2        tools_4.1.0            coda_0.19-4            gtable_0.3.0           glue_1.5.1             GenomeInfoDbData_1.2.7 fastmatch_1.1-3        Rcpp_1.0.7             bbmle_1.0.24           cellranger_1.1.0       jquerylib_0.1.4        vctrs_0.3.8            Biostrings_2.62.0      xfun_0.28              rvest_1.0.2            lifecycle_1.0.1        XML_3.99-0.8           MASS_7.3-54            zlibbioc_1.40.0        vroom_1.5.7            hms_1.1.1              parallel_4.1.0         yaml_2.2.1             memoise_2.0.1          gridExtra_2.3          emdbook_1.3.12         bdsmatrix_1.3-4        stringi_1.7.6          RSQLite_2.2.8          highr_0.9              genefilter_1.76.0      BiocParallel_1.28.0    rlang_0.4.12           pkgconfig_2.0.3        bitops_1.0-7           evaluate_0.14          lattice_0.20-45        labeling_0.4.2         bit_4.0.4              tidyselect_1.1.1       plyr_1.8.6             magrittr_2.0.1         R6_2.5.1               generics_0.1.1         DelayedArray_0.20.0    DBI_1.1.1              pillar_1.6.4           haven_2.4.3            withr_2.4.3            survival_3.2-13        KEGGREST_1.34.0        RCurl_1.98-1.5         modelr_0.1.8           crayon_1.4.2           utf8_1.2.2             tzdb_0.2.0             rmarkdown_2.11         locfit_1.5-9.4         grid_4.1.0             readxl_1.3.1           data.table_1.14.2      blob_1.2.2             reprex_2.0.1           digest_0.6.29          xtable_1.8-4           numDeriv_2016.8-1.1    munsell_0.5.0